;;;Draws a pressure tank from centers or ends.
;;;Requires: Ukword.lsp, Upoint.lsp, Ureal.lsp
;;;
(defun c:ptank (/ pttyp pt1 pt2 pi00 pi90 pi180 pi270 hwid ptp1 ptp2 plp1 plp2 plp3 plp4)
(setq pttyp (ukword 1 "Center End" "Place from Centers or Ends?" "End"))
(while
(setq pt1 (upoint 0 "" "First point of Pressure Tank" nil nil))
  (progn
    (setq pt2 (upoint 1 "" "Second point of Pressure Tank" nil nil))
    (setq ptwd (ureal 0 "" "Width of Pressure Tank" ptwd))
    (setq pi00 (angle pt1 pt2)
          pi180 (angle pt2 pt1)
          pi90 (+ pi00 (* pi 0.5))
          pi270 (+ pi00 (* pi 1.5))
          hwid (* ptwd 0.5)
    );setq
    (if (eq pttyp "End")
      (setq ptp1 (polar pt1 pi00 hwid)
            ptp2 (polar pt2 pi180 hwid)
            plp1 (polar ptp1 pi270 hwid)
            plp2 (polar ptp2 pi270 hwid)
            plp3 (polar ptp2 pi90 hwid)
            plp4 (polar ptp1 pi90 hwid)
      );setq
      (setq pt1 (polar pt1 pi180 hwid)
            pt2 (polar pt2 pi00 hwid)
            ptp1 (polar pt1 pi00 hwid)
            ptp2 (polar pt2 pi180 hwid)
            plp1 (polar ptp1 pi270 hwid)
            plp2 (polar ptp2 pi270 hwid)
            plp3 (polar ptp2 pi90 hwid)
            plp4 (polar ptp1 pi90 hwid)
      );setq
    );if
    (command ".pline" plp1 plp2 "a" plp3 "l" plp4 "a" plp1 "cl")
  );progn
);while
);defun